#include <iostream>
using namespace std;

class Car {
public:
	virtual void Drive() = 0; //纯虚函数
};

//派生类继承后也不能实例化出对象，
//只有重写纯虚函数，派生类才能实例化出对象
class Benz :public Car
{
public:
	virtual void Drive()
	{
		cout << "Benz-舒适" << endl;
	}
};

class BMW :public Car
{
public:
	virtual void Drive()
	{
		cout << "BMW-操控" << endl;
	}
};

void CarDrive()
{
	Benz bz;
}


class Animal
{
public:
	virtual void  sound() const = 0;
};
class cat :public Animal 
{
public:
	virtual void sound() const
	{
		cout << "喵喵" << endl;
	}
};

class dog :public Animal 
{
public:
	virtual void sound() const
	{
		cout << "汪汪" << endl;
	}
};

void AnimalSound(const Animal& anm) 
{
	anm.sound();
}

int main()
{
	AnimalSound(cat());
	AnimalSound(dog());

	return 0;
}